import java.sql.Connection;
import java.sql.SQLException;

import org.junit.Test;

import cn.itcast.jdbc.JdbcUtils;


public class testJDBC {

	
	@Test 
	public void testGetConnection() throws SQLException{
		Connection conn=JdbcUtils.getConnection();
		System.out.println(conn);
		
		JdbcUtils.releaseConnection(conn);
		System.out.println(conn.isClosed());
	}
	
	@Test
	public void testTansaction(){
		try{
		JdbcUtils.beginTransaction();	
		JdbcUtils.commitTransaction();
		}catch(Exception e){
			try {
				JdbcUtils.rollbackTransaction();
			} catch (SQLException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		}
	}
}
